<?php
//This view shows the search-results for users, which can be found by any tag
// that is connected with the users fields in the database.

//Initializing table for structure of users.
$TABLE = array();

echo heading("Search Results",2);

//Checking if any users have been found by a given search-term.
if (count($results))
{
    foreach ($results as $id => $person)
    {
        $string = "<small>" . anchor("users/home/".$person->id,$person->first_name . " ". $person->last_name) . "</small>";
        $string .= br();

        $properties = array(
                                'src' => 'users/get_photo/'. $person->id,
                                'width' => '130',
                                'height' => '120'
        );
        $string .= img($properties,true);
        $properties = array();
        $string .= br();
        
        $TABLE[] = $string;

    }

    //Structuring the table, so the result looks pretty, using the CI_table
    $tmpl = array (
            'table_open'  => "<table class='grid'>",
            'row_start'   => "<tr valign='top'>",
    );
    $this->table->set_template($tmpl);
    $this->table->set_empty("&nbsp;");
    $pretty = $this->table->make_columns($TABLE,3);

    echo $this->table->generate($pretty);
}
else
{
    echo "Sorry, no search results matched that query!";
}